<?php
abstract class resource_api_abstract implements resource_api_interface {
	
	protected static $_isInDtabase = false;
	protected static function saveToDatabase($data) {
		try {
			$content = new resource_file_concept();
			if(!($row = $content->fetch(array('hash = ?' => $data['hash'])))) {
				$row = $content->create();
				$row->setHash($data['hash']);
				$row->setSize($data['size']);
				$row->setExtension($data['ext']);
				$row->setWidth($data['dimension']['width']);
				$row->setHeight($data['dimension']['height']);
			} else {
				self::$_isInDtabase = true;
			}
			return $row;
		} catch (Exception $e) {
			throw new resource_exception($e->getMessage());
		}
	}
	
}
